package com;

import java.io.*;

public class TagsTest {


	public static void main(String[] args) {
		String dir = "D:/read/audiobooks/unsorted/Zoshenko_Averchenko_1/01";
//		String dir = "D:/upload/test";
//		String dir = "D:/upload/VP";
		convert(dir);
	}
	
	public static void convert(String dir){
		String artist = "Zoshenko_Averchenko";
//		String artist = "Vera Pavlova";
		ID3TagsTranslit.setArtist(artist);
		
		File root = new File(dir);
		if(!root.isDirectory()){
			System.out.println("___________Wrong path!!!_________");
			System.exit(0);
		}
		
		String[] s = root.list();
		for(int i=0; i<s.length;i++){
			String filepath = root.getPath()+"/"+s[i];
			File f = new File(filepath);
			if(f.isDirectory()){
                convert(filepath);
			}
			else{
				String ss = f.getName().toString();
				int ind = ss.indexOf(".");
				String pref = ss.substring(0, ind) + "_";							
				ID3TagsTranslit.convert(filepath, pref, "");
			}
		}		
	}

}

